<template>
    <div>
        <ul>
            <li
                v-for="item in list"
                :key="item.id"
                :class="newstatusID === item.id ? 'color' : ''"
                @click="changeID(item.id)"
            >
                {{ item.name }}
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    data() {
        return {
            list: [
                {
                    id: 1,
                    name: '一句诗词'
                },
                {
                    id: 2,
                    name: '励志句子'
                },
                {
                    id: 3,
                    name: '毒鸡汤'
                }
            ],
            newstatusID: 1
        };
    },
    mounted() {
        this.changeID(this.newstatusID);
    },
    methods: {
        changeID(i) {
            this.newstatusID = i;
            if (i === 1) {
                this.$router.push('/poetry');
            } else if (i === 2) {
                this.$router.push('/sentence');
            } else {
                this.$router.push('/about');
            }
        }
    }
};
</script>

<style scoped lang="scss">
ul {
    margin-top: 30px;

    li {
        cursor: pointer;
        text-align: center;
        margin-top: 10px;
        color: #b8b8b8;
        font-size: 14px;
    }
}

.color {
    color: #4caf50;
}

li:hover {
    color: #4caf50;
}
</style>
